<template>
  <div class="wall-rock">
    <img src="../../../assets/chart-data-bg.png" />
    <div class="title">
      <div class="title-left">
        <span>围岩等级断面占比</span>
        <img src="../../../assets/show-title-bg.png" />
      </div>
    </div>
    <div class="wall-rock-data">
      <div :style="{ zoom: zoom }" id="weiyandengji" class="wall-rock-data-view"></div>
    </div>
  </div>
</template>

<script>
import api from "../../../api";
export default {
  components: {},
  data() {
    return {
      myChart: {},
      zoom: 1,
    };
  },
  mounted() {
   this.$bus.$on("wallrockweiyan", (row) => {
      this.getdata(row)
    }); 
  },
  created() {
    const _this = this;
    _this.zoom = 1 / _this.pxzoom().zoom;
  },
  methods: {
    getdata(tid) {
      api
        .bigdatagetweiyan({ tid })
        .then((res) => {
          if (res.data.code == 2001) {
             this.$charts.WeiyanMap("weiyandengji", res.data.data);
          }
        })
        .catch((err) => {
          console.log(err);
        });
    },
  },
};
</script>

<style lang="scss" scoped>
.wall-rock {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;

  > img {
    width: 100%;
    height: 80%;
    position: absolute;
    left: 0;
    bottom: 0;
  }

  > .title {
    width: 100%;
    height: 43px;
    padding-right: 30px;
    position: relative;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: space-between;

    > span {
      color: #cecece;
      font-size: 18px;
    }

    > .title-left {
      flex: 1;
      height: 43px;
      display: flex;
      align-items: center;
      padding-left: 60px;
      position: relative;
      > img {
        width: 218px;
        height: 43px;
        position: absolute;
        left: 0;
        top: 0;
      }

      > span {
        position: relative;
        color: #fff;
        font-size: 18px;
      }
    }
  }

  > .wall-rock-data {
    width: 100%;
    flex: 1;
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    position: relative;
    box-sizing: border-box;

    .wall-rock-data-view {
      width: 100%;
      height: 100%;
    }
  }
}
</style>
